<%
Class SwiperModel	
	Public Sub init
		db.tableName = "swiper"
		db.prikey	= "id"
		db.auto_ = array( _
			array("add_time","now",1,"function"), _		
			array("mod_time","now",2,"function") _		
		)
	End Sub	
	
	Function Save
		on error resume next
		dim data,fileName
		set data = POP_MVC.post("")	
		call db.data( data )		
		fileName = POP_MVC.Upload("file")
		if not isEmpty( fileName ) Then
			data("banner_path") = fileName
		End If	
		Save = False
		if db.create(2) Then
			if db.Save()>0 Then
				Save = True				
			End If
		End if
		set data = nothing		
		call L_("")
	End Function	
	
	Function Add
		on error resume next		
		dim data,fileName
		set data = POP_MVC.post("")			
		call db.data( data )
		fileName = POP_MVC.Upload("file")
		if not isEmpty( fileName ) Then
			data("banner_path") = fileName
		End If		
		Add = False
		if db.create(1) Then			
			if db.Add() > 0 Then				
				Add = True
			end If			
		End if	
		set data = nothing
	End Function
End Class
%>